# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-json4
_rockname=json4lua
pkgver=1.0.0
pkgrel=4
pkgdesc="JSON encoding / decoding module for Lua (JSON4lua)"
url="https://github.com/craigmj/json4lua"
arch="noarch"
license="MIT"
depends="lua"
source="$pkgname-$pkgver.tar.gz::https://github.com/craigmj/$_rockname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_rockname-$pkgver"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	install -D -m 644 json/json.lua "$pkgdir"/usr/share/lua/common/json.lua

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="b42e0848af5284950327ad6986fb651650f84d8287b0c75084e022f6468019e82e9bbc4ce165089582f06a082972e63fe5b8ba1cf6d040fbfdb704db430f3547  lua-json4-1.0.0.tar.gz"
